package Action;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;

import entity.Student;
import hibconfig.HibernateSessionFactory;


public class AddGrade {
	private String stuid;
	private String stupwd;
	private String c;
    private String pe;
    private String gcsj;
    private String math;
    private String mg;
    private String english;
	public String getC() {
		return c;
	}
	public void setC(String c) {
		this.c = c;
	}
	public String getPe() {
		return pe;
	}
	public void setPe(String pe) {
		this.pe = pe;
	}
	public String getGcsj() {
		return gcsj;
	}
	public void setGcsj(String gcsj) {
		this.gcsj = gcsj;
	}
	public String getMath() {
		return math;
	}
	public void setMath(String math) {
		this.math = math;
	}
	public String getMg() {
		return mg;
	}
	public void setMg(String mg) {
		this.mg = mg;
	}
	public String getEnglish() {
		return english;
	}
	public void setEnglish(String english) {
		this.english = english;
	}
	
    public String getStuid() {
		return stuid;
	}
	public void setStuid(String stuid) {
		this.stuid = stuid;
	}
	
	public String getStupwd() {
		return stupwd;
	}
	public void setStupwd(String stupwd) {
		this.stupwd = stupwd;
	}
	public String execute(){
		  Session session=HibernateSessionFactory.getSession();
		  Student grade=new Student(stuid,stupwd,c,pe,gcsj,math,mg,english);
	      Transaction tran=session.beginTransaction();
	      session.update(grade);
	      tran.commit();
	      session.close();
		return "success";
	}
}
